package cn.quevo.ucenter.core.exception;

import java.util.Set;

import org.springframework.http.HttpStatus;

import cn.quevo.core.enums.EnumsInterface;
import cn.quevo.core.exception.CustomException;
import cn.quevo.core.lang.StringUtils;

/**
 * 授权认证异常
 * 
 * @author July july_sky@foxmail.com
 * @date 2018年3月26日 上午10:39:32
 * @Copyright ©2015-2035 湘豫(北京)科技有限公司. All Rights Reserved.
 * @version 1.0
 */
public class OauthException extends CustomException {

    /**
     * 
     */
    private static final long serialVersionUID = -4368206395282212800L;

    private Integer responseStatus;

    public Integer getResponseStatus() {
        return responseStatus;
    }

    public void setResponseStatus(Integer responseStatus) {
        this.responseStatus = responseStatus;
    }

    public OauthException(Integer responseStatus, EnumsInterface enums) {
        super(enums);
        this.responseStatus = responseStatus;
    }

    public OauthException(Integer responseStatus, Integer status, String msg) {
        super(status, msg);
        this.responseStatus = responseStatus;
    }

    public OauthException(EnumsInterface enums) {
        this(HttpStatus.BAD_REQUEST.value(), enums);
    }

    public OauthException(EnumsInterface enums, Set<String> errors) {
        this(enums);
        if (!StringUtils.isEmpty(errors)) {
            super.setMsg(StringUtils.join(errors, ","));
        }
    }
}
